package com.yzt.message;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.yzt.zhuju.base.BaseApplication;
import com.yzt.zhuju.broadcast.NotifyBroadCastReceiver;
import com.yzt.zhuju.network.entity.call.AgoraCallMsg;
import com.yzt.zhuju.utils.NotificationUtils;

/**
 * 融云通知栏消息消息，封装
 */
public class RongYunNotifyHelper {

    /**
     * 来电通知发送
     */
    public static void IncomeCallNotify(Context mContext, AgoraCallMsg callMsg) {
        if (BaseApplication.isAppForeground(mContext)) {
            return;
        }
        Intent intent = new Intent();
        Bundle mBundle = new Bundle();
        mBundle.putString(NotifyBroadCastReceiver.KEY_NOTIFY_TYPE, NotifyBroadCastReceiver.TYPE_OTHER);
        mBundle.putString(NotifyBroadCastReceiver.KEY_EVENT_TYPE, NotifyBroadCastReceiver.TYPE_OTHER_EVENT_MAIN_CALL);
        mBundle.putSerializable("AgoraCallMsg", callMsg);
        intent.putExtras(mBundle);
        intent.setClass(mContext, NotifyBroadCastReceiver.class);
        new NotificationUtils(mContext).sendNotification(mContext.getString(R.string.call_tip), mContext.getString(R.string.u_have_a_call_tip_search_more), intent);
    }

    /**
     * 进入聊天室推送
     */
    public static void JoinChatRoomNotify(Context mContext, String roomid, String content) {
        Intent intent = new Intent();
        Bundle mBundle = new Bundle();
        mBundle.putString(NotifyBroadCastReceiver.KEY_NOTIFY_TYPE, NotifyBroadCastReceiver.TYPE_OTHER);
        mBundle.putString(NotifyBroadCastReceiver.KEY_EVENT_TYPE, NotifyBroadCastReceiver.TYPE_OTHER_EVENT_CHAT_ROOM);
        mBundle.putString("roomdId", roomid);
        intent.putExtras(mBundle);
        intent.setClass(mContext, NotifyBroadCastReceiver.class);
        new NotificationUtils(mContext).sendNotification("" +
                "Nomi", content, intent);
    }

    /**
     * 根据路由跳转得通知栏
     */
    public static void ARouteNotify(Context mContext, String title, String content, String arouteJson) {
        Intent intent = new Intent();
        Bundle mBundle = new Bundle();
        mBundle.putString(NotifyBroadCastReceiver.KEY_NOTIFY_TYPE, NotifyBroadCastReceiver.TYPE_AROUTER);
        mBundle.putString(NotifyBroadCastReceiver.BUNDLE_AROUTER_JSON, arouteJson);
        intent.putExtras(mBundle);
        intent.setClass(mContext, NotifyBroadCastReceiver.class);
        new NotificationUtils(mContext).sendNotification(title, content, intent);
    }
}
